#!/bin/bash

folder_path="./cuda_file"
if [ ! -d "$folder_path" ]; then
    mkdir -p "$folder_path"
fi

echo "--------------------**begin compiling**--------------------"

nvcc point_net_cuda/batch_half.cu -o cuda_file/mycuda -Xcompiler "-O3 -std=c++14" -gencode arch=compute_60,code=sm_60 \
    -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 \
    -gencode arch=compute_70,code=sm_70  -I /usr/include/hdf5/serial -L /usr/lib/x86_64-linux-gnu/hdf5/serial-lhdf5 -lhdf5_cpp

if [ $? -eq 0 ]; then
    echo "Compilation successfully!."
    chmod +777 ./cuda_file/mycuda
    echo "--------------------**begin running**--------------------"
    ./cuda_file/mycuda
else
    echo "Compilation failed."
    exit 1
fi
